package cn.lyj.study.controller;

import cn.lyj.study.pojo.Food;
import cn.lyj.study.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@CrossOrigin
@RequestMapping("/food")
public class FoodController {
    @Autowired
    FoodService foodService;
    @ResponseBody
    @RequestMapping("/list")
    public List<Food> getFood(){
        return foodService.getAllFood();
    }
}
